package top.txl.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.PathVariable;
import top.txl.entity.Employee;

import java.util.List;

@Mapper
public interface EmployeeMapper extends BaseMapper<Employee> {

//    @Select("update employee set status=#{status} where id = #{id}")
//    void updateStatus(Employee emp);

    @Select("select * from reggie.employee where username=#{username}")
    Employee admin(Employee employee);

    List<Employee> lists(String keyWords);

    @Select("insert into employee(name, password,username, phone, sex, id_number, create_time, update_time,update_user,create_user)\n" +
            "values (#{name},#{password},#{username},#{phone},#{sex},#{idNumber},#{createTime},#{updateTime},#{updateUser},#{createUser})")
    void add(Employee employee);

    void update(Employee employee);

    @Select("delete from employee where id=#{id}")
    void delete(Integer id);

    @Select("select id, name, username, password, phone, sex, id_number idNumber, status from employee where id=#{id}")
    Employee detail(Integer id);
}
